<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../link.html"%>
<%@ page import="hotel.entity.*,java.util.*,java.text.SimpleDateFormat" %>
<%!SimpleDateFormat format=new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒"); %>
<script type="text/javascript">
$(document).ready(function() {
	$("#btn-close").click( function () { 
		var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		parent.layer.close(index); //再执行关闭 
	});
	
});
</script>


<div style="padding-top:25px;padding-left:80px;">
	<form id="checkinForm" action="#" class="form-horizontal" 
	data-toggle="validator" role="form">
		
		<div class="form-group">
			<label class="col-sm-3 control-label">订单号</label>
			<div class="col-sm-6">
				<input id="amount" name="amount" class="form-control" readonly value="${sales.orderNumber}">	
			</div>
		</div>
		
		<div class="form-group">
			<label class="col-sm-3 control-label">房间类型</label>
			<div class="col-sm-2">
				<input class="form-control" value="${sales.category.categoryName}" readonly>
			</div>
			<label class="col-sm-2 control-label">房间数量</label>
			<div class="col-sm-2">
				<input class="form-control" value="${sales.amount}" readonly>
			</div>
		</div>
		
		<div class="form-group">
			<label class='col-sm-3 control-label'>金额</label>
			<div class='col-sm-2'>
				<div class="input-group">
					<span class="input-group-addon">
						<i class="fa fa-cny"></i>
					</span>
					<input id="totalPrice" class='form-control' value="${sales.totalPrice}" readonly>
				</div>
			</div>
			<label class='col-sm-2 control-label'>操作员</label>
			<div class='col-sm-2'>
				<input class='form-control' value="${sales.operateUser.name}" readonly>
			</div>
		</div>

		<div class="form-group">
			<label class='col-sm-3 control-label'>销售时间</label>
			<div class='col-sm-6'>
				<input class='form-control' value="<%=format.format(((Sales)request.getAttribute("sales")).getSalesTime())%>" readonly>
			</div>
		</div>
		
		<div class="box-footer"></div>
		
		<div class="form-group">
			<label class='col-sm-3 control-label' style="color:green"><i>订单明细</i></label>
		</div>
		
		<%
		List<SalesLineItem> list=(List<SalesLineItem>)request.getAttribute("salesLineItem");
		for(SalesLineItem s:list){
		%>
		<div class='form-group'>
			<label class='col-sm-3 control-label'>入住房间</label>
			<div class='col-sm-2'>
				<input class='form-control' value="<%=s.getRoom().getNo()%>" readonly>
			</div>
			<label class='col-sm-2 control-label'>入住人数</label>
			<div class='col-sm-2'>
				<input class='form-control' value="<%=s.getCount()%>" readonly>
			</div>
		</div>
		
		<div class='form-group'>
			<label class='col-sm-3 control-label'>入住时间</label>
			<div class='col-sm-6'>
				<input class='form-control' value="<%=format.format(s.getCheckin_time())%>" readonly>
			</div>
		</div>
		
		<div class='form-group'>
			<label class='col-sm-3 control-label'>退房时间</label>
			<div class='col-sm-6'>
				<input class='form-control' value="<%if(s.getCheckout_time()==null) out.print("未退房");else out.print(format.format(s.getCheckout_time()));%>" readonly>
			</div>
		</div>
		<%
			for(ItemDescription desc:s.getDescriptions()){
		%>
		<div class="form-group">
			<label class="col-sm-3 control-label">入住人姓名</label>
			<div class="col-sm-6">
				<input value="<%=desc.getCustomerName()%>" class="form-control" readonly>
			</div>
		</div>

		<div class='form-group'>
			<label class='col-sm-3 control-label'>身份证号码</label>
			<div class='col-sm-3'>
				<input value='<%=desc.getId_number()%>' class='form-control' readonly>
			</div>
			<label class='col-sm-1 control-label'>电话</label>
			<div class='col-sm-2'>
				<input value='<%=desc.getTele()%>' class='form-control' readonly>
			</div>
		</div>
	
		<div class="box-footer"></div>
		<%} }%>
		
		<div class="box-footer"></div>
		
		<div class="form-group">
			<label class="col-sm-4 control-label"></label>
			<div class="col-sm-5">
				<div class="pull-right">
					<button id="btn-close" class="btn btn-close btn-primary" type="button">
						<i class="fa fa-remove"></i> 关闭
					</button>
				</div>
			</div>
		</div>
	</form>
</div>